package com.m3958.firstgwt.client.datasource;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.m3958.firstgwt.client.constants.UrlStatisticsFieldConstants;
import com.m3958.firstgwt.client.types.UrlStatisticsField;
import com.m3958.firstgwt.shared.type.CommonField;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;


@Singleton
public class UrlStatisticsDataSource extends BaseDataSource{

    
    public static String className = "com.m3958.firstgwt.server.model.UrlStatistics";
    
    @Inject
    public UrlStatisticsDataSource(DsErrorHandler deh,UrlStatisticsFieldConstants constants) {
    	setID("UrlStatisticsDs");
        DataSourceTextField refererField = new DataSourceTextField(CommonField.REFERER.getValue(),constants.referer());
        
        DataSourceIntegerField hitCountField = new DataSourceIntegerField(UrlStatisticsField.HIT_COUNT.getValue(),constants.hitCount());
   
        addHandleErrorHandler(deh);
        setFields(getIdField(),getSiteIdField(constants),getCreatedAtField(true,constants),getVersionField(),refererField,hitCountField);
        setClientOnly(false);
    }
    
	@Override
	protected String getModelClassName() {
		return className;
	}
}
